package com.aaa.custom.service.cart;

import com.aaa.entity.cart_order.kwc.Cart;
import com.aaa.entity.cart_order.kwc.CartList;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * fileName:CartService
 * description:
 * author:xxx
 * createTime:2020/2/14 13:41
 * version:1.0.0
 */
public interface CartService {

    /**
     * 根据用户id，店铺id查询购物车
     * @param member_id
     * @param shop_id
     * @return
     */
    List<CartList> getCartById(long member_id,long shop_id);

    /**
     * 清空购物车
     * @param member_id
     * @param shop_id
     * @return
     */

    int deleteAll(@Param("member_id") long member_id, @Param("shop_id") long shop_id);


    /**
     * 添加购物车
     * @param cart
     * @return
     */

    int addCart(CartList cart);

    /**
     * 判断传入商品是否存在购物车
     * @param member_id
     * @param shop_id
     * @param product_id
     * @return
     */
    List<CartList> ExisProduct(@Param("member_id") long member_id,@Param("shop_id") long shop_id,@Param("product_id") long product_id);


    /**
     * 相同商品数量加一
     * @param member_id
     * @param shop_id
     * @param product_id
     * @return
     */
    int updateNum(@Param("member_id") long member_id,@Param("shop_id") long shop_id,@Param("product_id") long product_id);


    /**
     * 减购物车数量
     * @param cart
     * @return
     */
    int subtractCart(CartList cart);
}
